﻿<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="AteckCsharp._Default" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <script lang="javascript" type="text/javascript">
        function tall(A, tAll) {
            var d1 = document.getElementById(A)

        }
        function JvfunonBlur(A, B, C, D, E, F, G, total, all) {
            
            var d1 = document.getElementById(A).value;
            var d2 = document.getElementById(B).value;
            var d3 = document.getElementById(C).value;
            var d4 = document.getElementById(D).value;
            var d5 = document.getElementById(E).value;
            var d6 = document.getElementById(F).value;
            var d7 = document.getElementById(G).value;
      
            if (d1 == '') { d1 = 0 };
            if (d2 == '') { d2 = 0 };
            if (d3 == '') { d3 = 0 };
            if (d4 == '') { d4 = 0 };
            if (d5 == '') { d5 = 0 };
            if (d6 == '') { d6 = 0 };
            if (d7 == '') { d7 = 0 };

            var tot = +d1 + +d2 + +d3 + +d4 + +d5 + +d6 + +d7;
          if (tot == '0'){}else{document.getElementById(total).value = tot;}
            var totalAll;
            var tt;
            var grid = document.getElementById('<% =gdvTimeBooking.ClientID %>');
            var gg = 0;
            var tt = 0;
            for(i = 1; i < 13; i++)
            {
               gg = parseInt( grid.rows[i].cells[8].childNodes[1].value);
        
               if(!isNaN(gg))
               {
               tt += gg;
               }
      
            }
            document.getElementById('<%=((TextBox)gdvTimeBooking.FooterRow.FindControl("txtTotalAll")).ClientID %>').value = tt
           
               
         
            
           <%-- alert("Hey");
            var tue = document.getElementById(A).value;
            document.getElementById(B).value = tue;
            alert(tue);
            var grid = document.getElementById('<%=GridView1.ClientID %>');
          
           var totalcol1 = 0;

           var col2;
           var totalcol2 = 0;


           for (i = 0; i < grid.rows.length; i++) {
               col1 = grid.rows[i].cells[0];
               col2 = grid.rows[i].cells[1];

               for (j = 0; j < col1.childNodes.length; j++) {
                   if (col1.childNodes[j].type == "text") {
                       if (!isNaN(col1.childNodes[j].value) && col1.childNodes[j].value != "") {
                           totalcol1 += parseInt(col1.childNodes[j].value)
                       }
                   }
               }

               for (j = 0; j < col2.childNodes.length; j++) {
                   if (col2.childNodes[j].type == "text") {
                       if (!isNaN(col2.childNodes[j].value) && col2.childNodes[j].value != "") {
                           totalcol2 += parseInt(col2.childNodes[j].value)
                       }
                   }
               }
           }
           document.getElementById('<%=txttotal1.ClientID %>').value = totalcol1;
        document.getElementById('<%=txttotal2.ClientID %>').value = totalcol2;--%>
       }

    </script>
     <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
                    </asp:ToolkitScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server"> 
    <ContentTemplate>
    <div>

                   


        <table>
            <tr>
                <td align="right">
                    <asp:Label ID="lbEmpName" runat="server" Text="Employee:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="EmployeeName" runat="server" Enabled =" false"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td align="right">
                    <asp:Label ID="Label1" runat="server" Text="Group:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtGroupName" runat="server" Enabled="false"></asp:TextBox>
                </td>
            </tr>
        </table>
    <br />    
    </div>
     <div>
    <asp:GridView ID="gdvTimeBooking" runat="server" AutoGenerateColumns="False" 
             Height="58px" RowStyle-HorizontalAlign="Center" Width="839px" 
             style="margin-right: 0px" ShowFooter="True" 
             onrowdatabound="gdvTimeBooking_RowDataBound" CellPadding="4" 
             ForeColor="#333333" GridLines="None" DataKeyNames="ProjectId,Id,Year" >
        <AlternatingRowStyle BackColor="White" />
        <Columns>
            <asp:TemplateField HeaderText="Name" HeaderStyle-HorizontalAlign="Center">
                <FooterTemplate>
                    <asp:Label ID="Label2" runat="server" Font-Bold="True" Font-Size="Larger" Text="Total"></asp:Label>
                </FooterTemplate>
                <ItemTemplate>
                    <asp:DropDownList ID="ddlProject" runat="server" Height="20px" Width="176px" 
                        DataSourceID="DSGetProjects" DataTextField="ProjectName" 
                        DataValueField="ProjectId">
                        <asp:ListItem>Select</asp:ListItem>
                    </asp:DropDownList>
                </ItemTemplate>

<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                <ItemStyle HorizontalAlign="Center" Width="100px" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Sat" HeaderStyle-HorizontalAlign="Center" FooterStyle-HorizontalAlign="Center">
                <FooterTemplate>
                    <asp:TextBox ID="txtTSat" runat="server" Width="40px"></asp:TextBox>
                </FooterTemplate>
                <ItemTemplate>
                        <asp:TextBox ID="txtSat" runat="server" Width="40px" 
                        Text='<%# Bind("Sat") %>'></asp:TextBox>
                </ItemTemplate>

<FooterStyle HorizontalAlign="Center"></FooterStyle>

                <HeaderStyle Wrap="True" VerticalAlign="Middle" Width="100px" />
                <ItemStyle HorizontalAlign="Center" Width="70px" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Sun" HeaderStyle-HorizontalAlign="Center" FooterStyle-HorizontalAlign="Center">
                <FooterTemplate>
                    <asp:TextBox ID="txtTSun" runat="server" Width="40px"></asp:TextBox>
                </FooterTemplate>
                <ItemTemplate>
                    <asp:TextBox ID="txtSun" runat="server" Width="40px" Text='<%# Bind("Sun") %>'></asp:TextBox>
                </ItemTemplate>

<FooterStyle HorizontalAlign="Center"></FooterStyle>

<HeaderStyle HorizontalAlign="Center" Width="100px"></HeaderStyle>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Mon" HeaderStyle-HorizontalAlign="Center" FooterStyle-HorizontalAlign="Center">
                <FooterTemplate>
                    <asp:TextBox ID="txtTMon" runat="server" Width="40px"></asp:TextBox>
                </FooterTemplate>
                <ItemTemplate>
                    <asp:TextBox ID="txtMon" runat="server" Width="40px" Text='<%# Bind("Mon") %>'></asp:TextBox>
                </ItemTemplate>

<FooterStyle HorizontalAlign="Center"></FooterStyle>

<HeaderStyle HorizontalAlign="Center" Width="100px"></HeaderStyle>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Tue" FooterStyle-HorizontalAlign="Center">
                <FooterTemplate>
                    <asp:TextBox ID="txtTTue" runat="server" Width="40px"></asp:TextBox>
                </FooterTemplate>
                <ItemTemplate>
                    <asp:TextBox ID="txtTue" runat="server" Width="40px"  Text='<%# Bind("Tue") %>'></asp:TextBox>
                </ItemTemplate>

<FooterStyle HorizontalAlign="Center"></FooterStyle>

                <HeaderStyle HorizontalAlign="Center" Width="100px" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Wed" FooterStyle-HorizontalAlign="Center">
                <FooterTemplate>
                    <asp:TextBox ID="txtTWed" runat="server" Width="40px"></asp:TextBox>
                </FooterTemplate>
                <ItemTemplate>
                    <asp:TextBox ID="txtWed" runat="server" Width="40px"  Text='<%# Bind("Wed") %>'></asp:TextBox>
                </ItemTemplate>

<FooterStyle HorizontalAlign="Center"></FooterStyle>

                <HeaderStyle HorizontalAlign="Center" Width="100px" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Thur" FooterStyle-HorizontalAlign="Center">
                <FooterTemplate>
                    <asp:TextBox ID="txtTThur" runat="server" Width="40px"></asp:TextBox>
                </FooterTemplate>
                <ItemTemplate>
                    <asp:TextBox ID="txtThur" runat="server" Width="40px" Text='<%# Bind("Thur") %>'></asp:TextBox>
                </ItemTemplate>

<FooterStyle HorizontalAlign="Center"></FooterStyle>

                <HeaderStyle HorizontalAlign="Center" Width="100px" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Fri" FooterStyle-HorizontalAlign="Center">
                <FooterTemplate>
                    <asp:TextBox ID="txtTFri" runat="server" Width="40px"></asp:TextBox>
                </FooterTemplate>
                <ItemTemplate>
                    <asp:TextBox ID="txtFri" runat="server" Width="40px" Text='<%# Bind("Fri") %>'></asp:TextBox>
                </ItemTemplate>

<FooterStyle HorizontalAlign="Center"></FooterStyle>

                <HeaderStyle HorizontalAlign="Center" Width="100px" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Total" FooterStyle-HorizontalAlign="Center">
                <FooterTemplate >
                    <asp:TextBox ID="txtTotalAll" runat="server" Width="40px"></asp:TextBox>
                </FooterTemplate>
                <ItemTemplate>
                    <asp:TextBox ID="txtTotal" runat="server" Width="40px" Enabled="false"></asp:TextBox>
                </ItemTemplate>

<FooterStyle HorizontalAlign="Center"></FooterStyle>

                <HeaderStyle HorizontalAlign="Center" Width="100px" />
            </asp:TemplateField>
            <asp:BoundField DataField="UserId" Visible="False" />
            <asp:BoundField DataField="ProjectId" HeaderText="ProjectId" Visible="False" />
            <asp:BoundField DataField="Year" HeaderText="Year" Visible="False" />
            <asp:BoundField DataField="WeekNo" HeaderText="Week NO" Visible="False" />
            <asp:BoundField DataField="IsPayRoll" HeaderText="isPayroll" Visible="False" />
        </Columns>
        <EditRowStyle BackColor="#2461BF" />
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <HeaderStyle Wrap="True" HorizontalAlign="Right" BackColor="#507CD1" 
            Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle HorizontalAlign="Center" VerticalAlign="Middle" BackColor="#EFF3FB" />
       
        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
        <SortedAscendingCellStyle BackColor="#F5F7FB" />
        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
        <SortedDescendingCellStyle BackColor="#E9EBEF" />
        <SortedDescendingHeaderStyle BackColor="#4870BE" />
       
    </asp:GridView>
    
         <br />
         <%--<asp:Table ID="tbl" runat="server" GridLines="Both" Width="836px">
             <asp:TableRow>
                 <asp:TableHeaderCell Text="Total" BackColor="#7ab4b8" Width="176px"></asp:TableHeaderCell>
                 <asp:TableCell><asp:TextBox ID="txtSun" runat="server" Width="40px"></asp:TextBox></asp:TableCell>
                 <asp:TableCell><asp:Label ID="tSun" runat="server" ></asp:Label></asp:TableCell>
                 <asp:TableCell><asp:Label ID="tMon" runat="server" ></asp:Label></asp:TableCell>
                 <asp:TableCell><asp:Label ID="tTue" runat="server"></asp:Label></asp:TableCell>
                 <asp:TableCell><asp:Label ID="tWed" runat="server"></asp:Label></asp:TableCell>
                 <asp:TableCell><asp:Label ID="tThur" runat="server" ></asp:Label></asp:TableCell>
                 <asp:TableCell><asp:Label ID="tFri" runat="server" ></asp:Label></asp:TableCell>
                 <asp:TableCell><asp:Label ID="tSat" runat="server" ></asp:Label></asp:TableCell>
                 
             </asp:TableRow>
         </asp:Table>--%>
    <table>
        <tr>
            <td>
                <asp:Label ID="lb" runat="server" Text="Signature:"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="txtSignature" runat="server"></asp:TextBox>
            </td>
            <td>
                <asp:Button ID="btnSubmit" runat="server" Text="Submit" 
                    onclick="btnSubmit_Click1" />
            </td>
        </tr>
    </table>
    
</div>
       <br />
    
     <asp:SqlDataSource ID="DSGetProjects" runat="server" 
            ConnectionString="<%$ ConnectionStrings:fadi %>" 
            SelectCommand="SELECT ProjectId, ProjectName from Projects">
    </asp:SqlDataSource>
    </ContentTemplate>
   </asp:UpdatePanel>
</asp:Content>
